# encoding: utf-8
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
app = Flask(__name__)
app.config.from_object("config")
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
login_manager = LoginManager(app)
login_manager.login_view = "user.login"


# 注册蓝本
from .home import home as home_blueprint
from .user import user as user_blueprint
from .blog import blog as blog_blueprint
from .api import api_blueprint
app.register_blueprint(home_blueprint, url_prefix="/")
app.register_blueprint(user_blueprint, url_prefix="/user")
app.register_blueprint(blog_blueprint, url_prefix="/blog")
app.register_blueprint(api_blueprint, url_prefix="/api")



from app import models